import { userAccountLogin } from '@/api/user'
export default {
  // 开启命名空间
  namespaced: true,
  state: {
    profile: {}
  },
  mutations: {
    setUser (state, useInfo) {
      state.profile = useInfo
    },
    removeProfile (state) {
      state.profile = {}
    }
  },
  actions: {
    async asyncSetUser (ctx, { account, password }) {
      const res = await userAccountLogin({ account, password })
      ctx.commit('setUser', res.data.result)
    }
  }
}
